/**
 * 
 */
var btnList, btnSave, btnDelete, btnModify;
function general() {

	if (document.getElementById('btnList') != null) {
		document.getElementById('btnList').onclick = function() 
		{
			
				location.href = 'Portfolio.jsp'
			
		}
	}
	if (document.getElementById('btnInput') != null) {
		document.getElementById('btnInput').onclick = function() {
			location.href = 'Portfolio.jsp?inc=portInput.jsp';
		}

	}
}
function listInit() {
	general();
//	if (document.getElementById('btnSave') != null) {
//		document.getElementById('btnSave').onclick = function() {
//
//			var f = document.portFrm;
//			if (f.writer.value == '') {
//				alert('cate!');
//			} else {
//				f.submit();
//			}
//		}
//	}

}
function ir() {
	if (document.getElementById('btnList') != null) {
		document.getElementById('btnList').onclick = function() {
			location.href = 'Portfolio.jsp';
		}
	}
}

function goView(page, rno) {

	var f = document.getElementById('portFrm');

	f.nowPage.value = page;
	alert(page);
	f.rno.value = rno;
	f.find.value = document.port_list_frm.find.value;
	f.action = 'Portfolio.jsp?inc=portView.jsp';
//	f.action = 'Portfolio.jsp?inc=portView.jsp';
	f.submit();

}

function goPage(page) {

	var f = document.getElementById('portFrm')
	f.nowPage.value = page;
	f.find.value = document.port_list_frm.find.value;
	f.action = 'Portfolio.jsp';
	f.submit();
}

function portViewInit() {

	general();
	var pf = document.getElementById("portFrm");
	if (document.getElementById('btnModify') != null) {
		document.getElementById('btnModify').onclick = function(){
			alert("??");
			pf.action = 'Portfolio.jsp?inc=portModify.jsp';
			alert("????");
			pf.submit();
		}

	}
	

	if (document.getElementById('btnDelete')!= null) {
		document.getElementById('btnDelete').onclick = function() {
			var c = confirm("정말로 삭제하시겠습니까?");
			if(c)
				{
					pf.action = 'Portfolio.jsp?inc=portDelete.jsp';
					pf.submit();
				}
			
		}

	}
}
	function portModifyInit() {
		general();
		var f = document.getElementById("portmFrm");
		if(document.getElementById('btnModify')!=null){
		document.getElementById('btnModify').onclick = function() {
			if (f.writer.value==''){alert('임수정?');} 
			else {f.submit();}
			}
		}
	}

function portDeleteInit() {
	general();

}

function inputInit()
{
	
	var f = document.getElementById("portFrm");
	if(document.getElementById('btnSave')!=null){
	document.getElementById('btnSave').onclick = function() {
		if (f.writer.value==''){alert('임수정?');} 
		else {f.submit();}
		}
	}
	
	if(document.getElementById('btnList')!=null)
		{
			document.getElementById('btnList').onclick = function()
			{
				alert("?");
				var y = confirm("작성을 취소하시겠습니까?" +"<br>" + "작성 중인 글은 제거됩니다.");
				if(y)
					{
					location.href = 'Portfolio.jsp'
					}
			}
		}
}
